home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!news
- From: austern@isolde.mti.sgi.com (Matt Austern)
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Performance: C vs. C++
- Followup-To: comp.lang.c++,comp.lang.c
- Date: 15 Feb 1996 21:43:14 GMT
- Organization: SGI
- Message-ID: <AUSTERN.96Feb15134314@isolde.mti.sgi.com>
- References: <30F6BAAC.12B5@iastate.edu> <4da9pn$a45@news.bridge.net>
- <4dnpl2$c8g@classic.iinet.com.au> <3105E9DC.1BE3@enermet.fi>
- <DLr46y.7rH@txnews.amd.com> <4elk5l$3f2q@yuma.ACNS.ColoState.EDU>
- <pronet01.31.003EB1E6@indirect.com> <3117F980.7890@hpato.aus.hp.com>
- <4fgd62$asb@gaia.ns.utk.edu> <4frur0$73t@adam.telalink.net>
- <4fvr7k$a3l@stc06.ctd.ornl.gov>
- Reply-To: austern@mti.sgi.com
- NNTP-Posting-Host: isolde.mti.sgi.com
- In-reply-to: kennel@msr.epm.ornl.gov's message of 15 Feb 1996 17:41:08 GMT
-
- In article <4fvr7k$a3l@stc06.ctd.ornl.gov> kennel@msr.epm.ornl.gov (Matt Kennel) writes:
-
- > > What is a "dispatched pointer"?
- >
- > In C++ it would be a pointer to a base class which has 'virtual members',
- > where the particular function called is chosen by the actual run-time
- > type.
- >
- > In C++, if you have a pointer, then it is always conceivably dispatched,
- > unless everything in the class is declared "static".
- >
- > So here "reference semantics" (going through a pointer, a storage area
- > potentially aliased) are joined with "dispatchability".
-
- That's not quite true. In C++, a function call is dispatched only if
- the function is declared as virtual in the base class. You don't have
- to make any special declaration of a function to make it
- non-dispatched; you simply have to avoid doing anything special.
- Declaring a function to be static is something else entirely.
-
- And if you do have a pointer to a polymorphic class, and you want to
- call a virtual function and ensure that you're calling the base
- class's version, that's actually possible: instead of writing
- base_pointer->f(), you write base_pointer->base::f(). The syntax
- is ugly, to be sure, but it doesn't bother me that you have to use
- ugly syntax for such a rare operation.
- --
- Matt Austern
- SGI: MTI Compilers Group
- austern@isolde.mti.sgi.com
-